<template>
  <el-card class="box-card">
    <template #header>
      <div class="card-header">
        <span>网站介绍</span>
        <!-- <el-button type="primary" style="margin-left: 20px">默认模版</el-button> -->
      </div>
    </template>
    <!-- <div style="width: calc(100% - 400px)"> -->
    <div>
      <!-- <Editor :height="400" v-model="agreement"></Editor> -->
      <UEditorPlus :id="id1" v-model="agreement" :modelValue="agreement" />
      <el-button
        type="primary"
        class="height40 matop"
        @click="handleSubmit"
        style="width: 137px"
        >保存</el-button
      >
    </div>
  </el-card>
</template>
<script setup>
import { ref } from 'vue';
import {
  updatePrivacyPolicy,
  getPrivacyPolicy,
} from '@/api/agreement/agreement';
const id1 = 'aboutUs';
const { proxy } = getCurrentInstance();
const agreement = ref(
  '高考志愿选择的好坏直接影响学生未来的发展道路，南京会心升学信息科技有限公司秉持教育公平的情怀，以专业的态度帮助高三学子规划优秀的高考志愿选择方案，依托互联网+，采用先进的云计算技术，在海量录取数据中精准推荐大学和专业，让高三考生在高考冲刺的“最后一米”实现“完美撞线”，迈入人生的另外一段辉煌！​'
);
const handleUpdatePrivacyPolicy = () => {
  updatePrivacyPolicy({ templateData: agreement.value }).then((res) => {
    if (res.code == 20000) {
      proxy.$modal.msgSuccess(res.msg);
    }
  });
};
const handleSubmit = () => {
  handleUpdatePrivacyPolicy();
};
const fetchPrivacyPolicy = () => {
  getPrivacyPolicy().then(() => {});
};
fetchPrivacyPolicy();
</script>
<style lang="scss" scoped>
:deep(.el-form--inline .el-form-item) {
  margin-right: 7px;
}

:deep(.el-form-item--default) {
  margin-bottom: 4px;
}

.box-card {
  margin: 20px;

  .card-header {
    font-size: 20px;
    font-weight: 600;
    color: #1d2129;
    padding: 10px;

    .headerSize {
      color: #4e5969;
      font-size: 14px;
      margin-left: 12px;
      font-weight: 400;
      height: 20px;
      line-height: 21px;
    }
  }
}
</style>
